function fft_data = FUN_plotDFT(fig,data )
%FUN_plotDataFreq Summary of this function goes here
%   Detailed explanation goes here

%% Data preparation and preproccess
% sample time and frequency
% generate time and frequency sequence
size = length(data);
sampletime = 0.01;                                  %sample time that unit is second
ts = sampletime;
t = 0:sampletime:(size-1) * sampletime;             %time point
samplefreq = 1/sampletime;                          %sample frequency that unit is Hz
fs = samplefreq;
f = (0:(size-1))/size*samplefreq;                   %frequency point
FontSize = 12;   %12~16

%% Figure configuration
% figure get and setting
if fig == 1
    figobj = findobj('name','DFT_PPG');
    if isempty(figobj)
        figobj = fig('name','DFT_PPG');
    end
    set(groot,'CurrentFigure',figobj);
elseif fig == 2
    figobj = findobj('name','DFT_Motion');
    if isempty(figobj)
        figobj = fig('name','DFT_Motion');
    end
    set(groot,'CurrentFigure',figobj);
elseif fig == 3
    figobj = findobj('name','DFT_filterd');
    if isempty(figobj)
        figobj = fig('name','DFT_filterd');
    end
    set(groot,'CurrentFigure',figobj);
end

%% DFT analysis
fft_data=fft(data);
fft_data_abs=abs(fft_data);

fig(fig);subplot(2,1,2);
plot(f,fft_data_abs,'k');

end

